package com.android.jblm.commandcentral;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;

import com.android.jblm.commandcentral.adapters.PhoneAdapter;

import java.util.List;

/**
 * Created by Brian on 8/21/2014.
 */
public class PhoneListFragment extends ListFragment {

    List<String> list;
    ContactFragment.getContactListener mCallBack;

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);

        list = mCallBack.getCurContact().phoneNumbers;

        Log.w("SubHeaderFragment", "Header List Created");
        // Populate list with our static array of myHeaders.
        setListAdapter(new PhoneAdapter(getActivity(), list));
    }

    @Override
    public void onStart() {
        super.onStart();

    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            mCallBack = (ContactFragment.getContactListener) activity;



        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString()
                    + " must implement OnHeaderSelectedListener");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mCallBack = null;
    }

}
